<?php
/**
 * infoメソッドのテスト
 * 
 * @since 2012/04/26
 */
class TestCaseofInfo extends UnitTestCase {

	public function TestofInfo() {
		YuTori::init();	// 初期化

		$this->assertEqual($res = YuTori::info(), array(
			'count_construct' => 0,
			'count_destruct' => 0,
			'count_YuTori' => 0,
			'count_max_YuTori' => 0,
			'count_construct_object' => 0,
			'count_destruct_object' => 0,
			'count_object' => 0,
			'count_max_object' => 0,
		), 'init直後に全情報0になっているか');

		$y = YuTori::factory (null, 'test');
		$this->assertEqual(YuTori::info(), array(
			'count_construct' => 1,
			'count_destruct' => 0,
			'count_YuTori' => 1,
			'count_max_YuTori' => 1,
			'count_construct_object' => 1,
			'count_destruct_object' => 0,
			'count_object' => 1,
			'count_max_object' => 1,
		), '1件生成後の状態');

		$y = '';
		$this->assertEqual($res = YuTori::info(), array(
			'count_construct' => 1,
			'count_destruct' => 1,
			'count_YuTori' => 0,
			'count_max_YuTori' => 1,
			'count_construct_object' => 1,
			'count_destruct_object' => 1,
			'count_object' => 0,
			'count_max_object' => 1,
		), '1件破棄後の状態');

		$y = YuTori::factory (null, 'test');
		$y2 = YuTori::factory (null, 'test');
		$this->assertEqual(YuTori::info(), array(
			'count_construct' => 3,
			'count_destruct' => 1,
			'count_YuTori' => 2,
			'count_max_YuTori' => 2,
			'count_construct_object' => 3,
			'count_destruct_object' => 1,
			'count_object' => 2,
			'count_max_object' => 2,
		), '2件追加生成後の状態');
	}
}